#include <AVUIGradientBrush.h>

namespace AVUI {

class IClientRadialGradientBrush;

class RadialGradientBrush : public GradientBrush
{
public:
    RadialGradientBrush();
    ~RadialGradientBrush();


    DECLARE_ELEMENT(RadialGradientBrush, GradientBrush);

    DECLARE_DEPENDENCY_PROPERTY(Center);
    Point get_Center() { return AVUI::UnboxValue<Point>(GetValue(get_CenterProperty())); }
    void set_Center(const Point& value) { SetValue(get_CenterProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(RadiusX);
    float get_RadiusX() { return AVUI::UnboxValue<float>(GetValue(get_RadiusXProperty())); }
    void set_RadiusX(float value) { SetValue(get_RadiusXProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(RadiusY);
    float get_RadiusY() { return AVUI::UnboxValue<float>(GetValue(get_RadiusYProperty())); }
    void set_RadiusY(float value) { SetValue(get_RadiusYProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(GradientOrigin);
    Point get_GradientOrigin() { return AVUI::UnboxValue<Point>(GetValue(get_GradientOriginProperty())); }
    void set_GradientOrigin(const Point& value) { SetValue(get_GradientOriginProperty(), AVUI::BoxValue(value)); } 

    virtual void set_ActiveBrush(Renderer* pRenderer);

protected:

    virtual void OnGradientStopsChanged();
    virtual void CloneCore(Freezable* pSource);
    virtual TRefCountedPtr<Freezable> CreateInstanceCore() AVUI_OVERRIDE { return object_allocate<RadialGradientBrush>().get_Ptr(); }

private:
    static void StaticConstructor();

    static void CenterPropertyChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);
    static void RadiusXPropertyChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);
    static void RadiusYPropertyChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);
    static void GradientOriginPropertyChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);

    IClientRadialGradientBrush* m_pClientRadialGradientBrush;
    mutable bool m_needsGradientUpdate;
};

typedef TRefCountedPtr<RadialGradientBrush> RadialGradientBrushPtr;

}; // namespace AVUI
